#include <iostream>
#include <stdio.h>
#include <fstream>
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/prettywriter.h"
#include "rapidjson/stringbuffer.h"
#include "smsf_SmsRecordData_struct.h"
using namespace smsf_SmsRecordData;
string c2json(stSmsRecordData root)
{
rapidjson::StringBuffer strBuf;
rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf);
writer.StartObject();
writer.Key("smsRecordId");
writer.String(root.smsRecordId.c_str());
writer.Key("smsPayload");
writer.StartObject();
writer.Key("contentId");
writer.String(root.smsPayload.contentId.c_str());
writer.EndObject();
writer.Key("accessType");
writer.String(root.accessType.c_str());
writer.Key("gpsi");
writer.String(root.gpsi.c_str());
writer.Key("pei");
writer.String(root.pei.c_str());
writer.Key("ueLocation");
writer.StartObject();
writer.Key("eutraLocation");
writer.StartObject();
writer.Key("tai");
writer.StartObject();
writer.Key("plmnId");
writer.StartObject();
writer.Key("mcc");
writer.String(root.ueLocation.eutraLocation.tai.plmnId.mcc.c_str());
writer.Key("mnc");
writer.String(root.ueLocation.eutraLocation.tai.plmnId.mnc.c_str());
writer.EndObject();
writer.Key("tac");
writer.String(root.ueLocation.eutraLocation.tai.tac.c_str());
writer.Key("nid");
writer.String(root.ueLocation.eutraLocation.tai.nid.c_str());
writer.EndObject();
writer.Key("ecgi");
writer.StartObject();
writer.Key("plmnId");
writer.StartObject();
writer.Key("mcc");
writer.String(root.ueLocation.eutraLocation.ecgi.plmnId.mcc.c_str());
writer.Key("mnc");
writer.String(root.ueLocation.eutraLocation.ecgi.plmnId.mnc.c_str());
writer.EndObject();
writer.Key("eutraCellId");
writer.String(root.ueLocation.eutraLocation.ecgi.eutraCellId.c_str());
writer.Key("nid");
writer.String(root.ueLocation.eutraLocation.ecgi.nid.c_str());
writer.EndObject();
writer.Key("ignoreEcgi");
writer.Bool(root.ueLocation.eutraLocation.ignoreEcgi);
writer.Key("ageOfLocationInformation");
writer.Int(root.ueLocation.eutraLocation.ageOfLocationInformation);
writer.Key("ueLocationTimestamp");
writer.String(root.ueLocation.eutraLocation.ueLocationTimestamp.c_str());
writer.Key("geographicalInformation");
writer.String(root.ueLocation.eutraLocation.geographicalInformation.c_str());
writer.Key("geodeticInformation");
writer.String(root.ueLocation.eutraLocation.geodeticInformation.c_str());
writer.Key("globalNgenbId");
writer.StartObject();
writer.Key("plmnId");
writer.StartObject();
writer.Key("mcc");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.plmnId.mcc.c_str());
writer.Key("mnc");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.plmnId.mnc.c_str());
writer.EndObject();
writer.Key("n3IwfId");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.n3IwfId.c_str());
writer.Key("gNbId");
writer.StartObject();
writer.Key("bitLength");
writer.Int(root.ueLocation.eutraLocation.globalNgenbId.gNbId.bitLength);
writer.Key("gNBValue");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.gNbId.gNBValue.c_str());
writer.EndObject();
writer.Key("ngeNbId");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.ngeNbId.c_str());
writer.Key("wagfId");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.wagfId.c_str());
writer.Key("tngfId");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.tngfId.c_str());
writer.Key("nid");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.nid.c_str());
writer.Key("eNbId");
writer.String(root.ueLocation.eutraLocation.globalNgenbId.eNbId.c_str());
writer.EndObject();
writer.Key("globalENbId");
writer.StartObject();
writer.Key("plmnId");
writer.StartObject();
writer.Key("mcc");
writer.String(root.ueLocation.eutraLocation.globalENbId.plmnId.mcc.c_str());
writer.Key("mnc");
writer.String(root.ueLocation.eutraLocation.globalENbId.plmnId.mnc.c_str());
writer.EndObject();
writer.Key("n3IwfId");
writer.String(root.ueLocation.eutraLocation.globalENbId.n3IwfId.c_str());
writer.Key("gNbId");
writer.StartObject();
writer.Key("bitLength");
writer.Int(root.ueLocation.eutraLocation.globalENbId.gNbId.bitLength);
writer.Key("gNBValue");
writer.String(root.ueLocation.eutraLocation.globalENbId.gNbId.gNBValue.c_str());
writer.EndObject();
writer.Key("ngeNbId");
writer.String(root.ueLocation.eutraLocation.globalENbId.ngeNbId.c_str());
writer.Key("wagfId");
writer.String(root.ueLocation.eutraLocation.globalENbId.wagfId.c_str());
writer.Key("tngfId");
writer.String(root.ueLocation.eutraLocation.globalENbId.tngfId.c_str());
writer.Key("nid");
writer.String(root.ueLocation.eutraLocation.globalENbId.nid.c_str());
writer.Key("eNbId");
writer.String(root.ueLocation.eutraLocation.globalENbId.eNbId.c_str());
writer.EndObject();
writer.EndObject();
writer.Key("nrLocation");
writer.StartObject();
writer.Key("tai");
writer.StartObject();
writer.Key("plmnId");
writer.StartObject();
writer.Key("mcc");
writer.String(root.ueLocation.nrLocation.tai.plmnId.mcc.c_str());
writer.Key("mnc");
writer.String(root.ueLocation.nrLocation.tai.plmnId.mnc.c_str());
writer.EndObject();
writer.Key("tac");
writer.String(root.ueLocation.nrLocation.tai.tac.c_str());
writer.Key("nid");
writer.String(root.ueLocation.nrLocation.tai.nid.c_str());
writer.EndObject();
writer.Key("ncgi");
writer.StartObject();
writer.Key("plmnId");
writer.StartObject();
writer.Key("mcc");
writer.String(root.ueLocation.nrLocation.ncgi.plmnId.mcc.c_str());
writer.Key("mnc");
writer.String(root.ueLocation.nrLocation.ncgi.plmnId.mnc.c_str());
writer.EndObject();
writer.Key("nrCellId");
writer.String(root.ueLocation.nrLocation.ncgi.nrCellId.c_str());
writer.Key("nid");
writer.String(root.ueLocation.nrLocation.ncgi.nid.c_str());
writer.EndObject();
writer.Key("ageOfLocationInformation");
writer.Int(root.ueLocation.nrLocation.ageOfLocationInformation);
writer.Key("ueLocationTimestamp");
writer.String(root.ueLocation.nrLocation.ueLocationTimestamp.c_str());
writer.Key("geographicalInformation");
writer.String(root.ueLocation.nrLocation.geographicalInformation.c_str());
writer.Key("geodeticInformation");
writer.String(root.ueLocation.nrLocation.geodeticInformation.c_str());
writer.Key("globalGnbId");
writer.StartObject();
writer.Key("plmnId");
writer.StartObject();
writer.Key("mcc");
writer.String(root.ueLocation.nrLocation.globalGnbId.plmnId.mcc.c_str());
writer.Key("mnc");
writer.String(root.ueLocation.nrLocation.globalGnbId.plmnId.mnc.c_str());
writer.EndObject();
writer.Key("n3IwfId");
writer.String(root.ueLocation.nrLocation.globalGnbId.n3IwfId.c_str());
writer.Key("gNbId");
writer.StartObject();
writer.Key("bitLength");
writer.Int(root.ueLocation.nrLocation.globalGnbId.gNbId.bitLength);
writer.Key("gNBValue");
writer.String(root.ueLocation.nrLocation.globalGnbId.gNbId.gNBValue.c_str());
writer.EndObject();
writer.Key("ngeNbId");
writer.String(root.ueLocation.nrLocation.globalGnbId.ngeNbId.c_str());
writer.Key("wagfId");
writer.String(root.ueLocation.nrLocation.globalGnbId.wagfId.c_str());
writer.Key("tngfId");
writer.String(root.ueLocation.nrLocation.globalGnbId.tngfId.c_str());
writer.Key("nid");
writer.String(root.ueLocation.nrLocation.globalGnbId.nid.c_str());
writer.Key("eNbId");
writer.String(root.ueLocation.nrLocation.globalGnbId.eNbId.c_str());
writer.EndObject();
writer.EndObject();
writer.Key("n3gaLocation");
writer.StartObject();
writer.Key("n3gppTai");
writer.StartObject();
writer.Key("plmnId");
writer.StartObject();
writer.Key("mcc");
writer.String(root.ueLocation.n3gaLocation.n3gppTai.plmnId.mcc.c_str());
writer.Key("mnc");
writer.String(root.ueLocation.n3gaLocation.n3gppTai.plmnId.mnc.c_str());
writer.EndObject();
writer.Key("tac");
writer.String(root.ueLocation.n3gaLocation.n3gppTai.tac.c_str());
writer.Key("nid");
writer.String(root.ueLocation.n3gaLocation.n3gppTai.nid.c_str());
writer.EndObject();
writer.Key("n3IwfId");
writer.String(root.ueLocation.n3gaLocation.n3IwfId.c_str());
writer.Key("ueIpv4Addr");
writer.String(root.ueLocation.n3gaLocation.ueIpv4Addr.c_str());
writer.Key("ueIpv6Addr");
writer.String(root.ueLocation.n3gaLocation.ueIpv6Addr.c_str());
writer.Key("portNumber");
writer.Int(root.ueLocation.n3gaLocation.portNumber);
writer.Key("tnapId");
writer.StartObject();
writer.Key("ssId");
writer.String(root.ueLocation.n3gaLocation.tnapId.ssId.c_str());
writer.Key("bssId");
writer.String(root.ueLocation.n3gaLocation.tnapId.bssId.c_str());
writer.Key("civicAddress");
writer.String(root.ueLocation.n3gaLocation.tnapId.civicAddress.c_str());
writer.EndObject();
writer.Key("twapId");
writer.StartObject();
writer.Key("ssId");
writer.String(root.ueLocation.n3gaLocation.twapId.ssId.c_str());
writer.Key("bssId");
writer.String(root.ueLocation.n3gaLocation.twapId.bssId.c_str());
writer.Key("civicAddress");
writer.String(root.ueLocation.n3gaLocation.twapId.civicAddress.c_str());
writer.EndObject();
writer.Key("hfcNodeId");
writer.StartObject();
writer.Key("hfcNId");
writer.String(root.ueLocation.n3gaLocation.hfcNodeId.hfcNId.c_str());
writer.EndObject();
writer.Key("gli");
writer.String(root.ueLocation.n3gaLocation.gli.c_str());
writer.EndObject();
writer.EndObject();
writer.Key("ueTimeZone");
writer.String(root.ueTimeZone.c_str());
writer.EndObject();
string data = strBuf.GetString();
return data;
}
